let layer;
let form;
layui.use(['layer', 'form'], function () {
    layer = layui.layer;
    form = layui.form;
    //数据回填封装起来,下面要调用
    function huitian() {
        $.ajax({
            url: "/my/userinfo",
            // 设置请求头：
            headers: {
                Authorization: localStorage.getItem("token")
            },
            success: function (res) {
                if (res.status == 0) {
                    form.val("user", res.data)
                    console.log(res.data);
                }
            },

        })
    }
    huitian()

    $("form").on("submit", function (e) {
        e.preventDefault();
        let data = form.val("user")
        $.ajax({
            url: "/my/userinfo",
            // 设置请求头：
            type: "post",
            data: data,
            success: function (res) {
                console.log(res);
                layer.msg(res.message)
                window.parent.getlist()
            },

        })
    })


    $("form").on("reset", function (e) {
        e.preventDefault();
        huitian()
    })



});